<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <title>刘洪普pytorch课程笔记1 | 星海</title>

    <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">    
<meta name="viewport" content="width=device-width,minimum-scale=1">
<meta name="description" content="1前言 √ 深度学习区别于基于规则的系统 反向传播 2线性模型 √ 设计模型：只有一个参数w的模型，y=w*x 计算损失loss：y_pre-y，防止正负">
<meta name="generator" content="Hugo 0.91.0" />


  <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">


<link rel="stylesheet" href="/css/style.css">



<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />







  </head>

  <body>
    <nav class="navigation">
	
		<a href="/"> <span class="arrow">←</span>首页</a>
	
	<a href="/posts">按时间</a>
	<a href="/tags">按标签</a>
	<a href="/about">关于我</a>

	


</nav>


    <main class="main">
      

<section id="single">
    <h1 class="title">刘洪普pytorch课程笔记1</h1>

    <div class="tip">
        <time datetime="2021-12-21 00:00:00 &#43;0000 UTC">2021年12月21日</time>
        <span class="split">
          ·
        </span>
        <span>
          364字
        </span>
        <span class="split">
          ·
        </span>
        <span>
          1分钟
        </span>
    </div>

    
    


    <div class="content">
      <h2 id="1前言">1前言 <a href="#1%e5%89%8d%e8%a8%80" class="anchor">√</a></h2><ul>
<li>深度学习区别于基于规则的系统</li>
<li>反向传播</li>
</ul>
<h2 id="2线性模型">2线性模型 <a href="#2%e7%ba%bf%e6%80%a7%e6%a8%a1%e5%9e%8b" class="anchor">√</a></h2><ul>
<li>设计模型：只有一个参数w的模型，y=w*x</li>
<li>计算损失loss：y_pre-y，防止正负抵消，秋平方和</li>
<li>计算代价cost：取平均</li>
<li>损失函数（Loss Function）是定义在单个样本上的，算的是一个样本的误差，而代价函数（Cost Function ）是定义在整个训练集上的，是所有样本误差的平均，也就是损失函数的平均。</li>
<li>线性回归，保存w</li>
<li>预测</li>
</ul>
<h2 id="3梯度下降">3梯度下降 <a href="#3%e6%a2%af%e5%ba%a6%e4%b8%8b%e9%99%8d" class="anchor">√</a></h2><ul>
<li>上一节的w是从0开始寻找的，本节给出一个初始值，即参数初始化，然后从初始点进行梯度下降</li>
<li>用的是cost代价函数对w进行求偏导，寻找的也是cost代价函数最小的w值</li>
</ul>
<h2 id="4反向传播">4反向传播 <a href="#4%e5%8f%8d%e5%90%91%e4%bc%a0%e6%92%ad" class="anchor">√</a></h2><ul>
<li>激活函数存在的意义</li>
<li>1、Forward，计算loss</li>
<li>2、Backward，计算梯度</li>
<li>3、更新w</li>
<li>梯度清零</li>
</ul>
<h2 id="5使用pytorch">5使用pytorch <a href="#5%e4%bd%bf%e7%94%a8pytorch" class="anchor">√</a></h2><ul>
<li>准备数据集</li>
<li>设计模型</li>
<li>构建损失函数和优化器</li>
<li>循环训练</li>
<li>测试模型</li>
</ul>

    </div>

    
        <div class="tags">
            
                <a href="https://hebutai.gitee.io/tags/%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0">深度学习</a>
            
                <a href="https://hebutai.gitee.io/tags/pytorch">pytorch</a>
            
                <a href="https://hebutai.gitee.io/tags/%E5%88%98%E6%B4%AA%E6%99%AE">刘洪普</a>
            
        </div>
    
    

</section>


    </main>
    
    <footer id="footer">
    
        <div id="social">


    <a class="symbol" href="https://gitee.com/hebutAI" rel="me" target="_blank">
        
        <svg fill="#bbbbbb" width="28" height="28"  viewBox="0 0 72 72" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    
    <title>Github</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="Social-Icons---Rounded-Black" transform="translate(-264.000000, -939.000000)">
            <g id="Github" transform="translate(264.000000, 939.000000)">
                <path d="M8,72 L64,72 C68.418278,72 72,68.418278 72,64 L72,8 C72,3.581722 68.418278,-8.11624501e-16 64,0 L8,0 C3.581722,8.11624501e-16 -5.41083001e-16,3.581722 0,8 L0,64 C5.41083001e-16,68.418278 3.581722,72 8,72 Z" id="Rounded" fill="#bbbbbb"></path>
                <path d="M35.9985,13 C22.746,13 12,23.7870921 12,37.096644 C12,47.7406712 18.876,56.7718301 28.4145,59.9584121 C29.6145,60.1797862 30.0525,59.4358488 30.0525,58.7973276 C30.0525,58.2250681 30.0315,56.7100863 30.0195,54.6996482 C23.343,56.1558981 21.9345,51.4693938 21.9345,51.4693938 C20.844,48.6864054 19.2705,47.9454799 19.2705,47.9454799 C17.091,46.4500754 19.4355,46.4801943 19.4355,46.4801943 C21.843,46.6503662 23.1105,48.9634994 23.1105,48.9634994 C25.2525,52.6455377 28.728,51.5823398 30.096,50.9649018 C30.3135,49.4077535 30.9345,48.3460615 31.62,47.7436831 C26.2905,47.1352808 20.688,45.0691228 20.688,35.8361671 C20.688,33.2052792 21.6225,31.0547881 23.1585,29.3696344 C22.911,28.7597262 22.0875,26.3110578 23.3925,22.9934585 C23.3925,22.9934585 25.4085,22.3459017 29.9925,25.4632101 C31.908,24.9285993 33.96,24.6620468 36.0015,24.6515052 C38.04,24.6620468 40.0935,24.9285993 42.0105,25.4632101 C46.5915,22.3459017 48.603,22.9934585 48.603,22.9934585 C49.9125,26.3110578 49.089,28.7597262 48.8415,29.3696344 C50.3805,31.0547881 51.309,33.2052792 51.309,35.8361671 C51.309,45.0917119 45.6975,47.1292571 40.3515,47.7256117 C41.2125,48.4695491 41.9805,49.9393525 41.9805,52.1877301 C41.9805,55.4089489 41.9505,58.0067059 41.9505,58.7973276 C41.9505,59.4418726 42.3825,60.1918338 43.6005,59.9554002 C53.13,56.7627944 60,47.7376593 60,37.096644 C60,23.7870921 49.254,13 35.9985,13" fill="#FFFFFF"></path>
            </g>
        </g>
    </g>
</svg>
    </a>


</div>

    

    <div class="copyright">
    
       © Copyright 
       2022 
       <span class="split">
        <svg fill="#bbbbbb" width="15" height="15" version="1.1" id="heart-15" xmlns="http://www.w3.org/2000/svg" width="15px" height="15px" viewBox="0 0 15 15">
  <path d="M13.91,6.75c-1.17,2.25-4.3,5.31-6.07,6.94c-0.1903,0.1718-0.4797,0.1718-0.67,0C5.39,12.06,2.26,9,1.09,6.75&#xA;&#x9;C-1.48,1.8,5-1.5,7.5,3.45C10-1.5,16.48,1.8,13.91,6.75z"/>
</svg>
       </span>
       宇
    
    </div>

    
      <div class="powerby">
        Powered by <a href='http://www.gohugo.io/'>Hugo</a> Theme By <a href='https://github.com/nodejh/hugo-theme-cactus-plus'>nodejh</a>
      </div>
    
</footer>



  </body>
</html>
